1. Field of the Invention
The present invention relates generally to the implementation of an exponential function in computers, and, in particular, to an optimal set of instructions for performing an exponential function.
2. Description of the Related Art
One of the most important and widely used mathematical library functions in nearly every computer is one to evaluate integer powers of "real" or floating-point numbers. For example, the notation X**N (where X is usually called the base and N is called the exponent or power) is used in nearly every high-level language to represent this operation, in expressions such as "AREA=PI*R**2".
Prior art implementations generally involve looking at the binary representation of the exponent N, and doing successive floating point squaring of X and/or multiplications by X or X**2. This technique is currently used in the mathematical function libraries of Fortran, PL/I, COBOL, Pascal, APL, etc.
The primary shortcoming of the prior art is that the "bookkeeping overhead" of determining the bits of N and figuring out whether or not to square or multiply takes more instructions than for the actual evaluations. In early computers, floating point operations were relatively slow, so this was a reasonable approach. Now that floating point operations are fairly fast, the ratio of "useful" work to "overhead" is low.
Thus, there is a need in the art for improved methods of performing exponential functions.